# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=py3-awesomeversion
pkgver=24.2.0
pkgrel=1
pkgdesc="Python module to deal with versions"
url="https://github.com/ludeeus/awesomeversion"
license="MIT"
arch="noarch"
depends="python3"
makedepends="py3-gpep517 py3-installer py3-poetry-core"
checkdepends="py3-pytest py3-pytest-snapshot"
subpackages="$pkgname-pyc"
source="https://github.com/ludeeus/awesomeversion/archive/$pkgver/py3-awesomeversion-$pkgver.tar.gz
	version-placeholder.patch
	"
builddir="$srcdir/awesomeversion-$pkgver"

prepare() {
	default_prepare

	# set module version
	sed -i "s/@VERSION@/$pkgver/" pyproject.toml
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
d4dce1d016219a012184824c47b46aea803a702b6d2198ace2da66a3ad2fcc2efeeca347c7611ff16e2ddb4d2a15fae7fa0623b035247f2632892b07a470ca19  py3-awesomeversion-24.2.0.tar.gz
fff6ed74143de118289d6c0bd514d90a8a916e3604f0bfd1bbd230d537067f96229f8659e26e907f07d7e15ad33254ff4424384b3a56ff2090309d5cecf3a031  version-placeholder.patch
"
